package com.dream.keigezhushou.Activity.acty.play;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.dream.keigezhushou.Activity.BaseActivity;
import com.dream.keigezhushou.Activity.adapter.EvaluateAdapter;
import com.dream.keigezhushou.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard;

public class VideoInfoActivity extends BaseActivity implements View.OnClickListener{

    @BindView(R.id.video_player)
    JCVideoPlayerStandard videoPlayer;
    @BindView(R.id.iv_return)
    ImageView ivReturn;
    @BindView(R.id.iv_set)
    ImageView ivSet;
    @BindView(R.id.tv_report)
    TextView tvReport;
    @BindView(R.id.tv_zan)
    TextView tvZan;
    @BindView(R.id.tv_date)
    TextView tvDate;
    @BindView(R.id.tv_describe)
    TextView tvDescribe;
    @BindView(R.id.lv_evaluate)
    ListView lvEvaluate;
    @BindView(R.id.rl_write_evaluate)
    RelativeLayout rlWriteEvaluate;
    private Intent intent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video_info);
        ButterKnife.bind(this);

        initView();
        initData();
    }


    //初始化界面
    protected void initView(){

        //ListView创建适配器
        lvEvaluate.setDivider(null);
        lvEvaluate.setAdapter(new EvaluateAdapter(this));
    }


    //初始化数据
    protected void initData(){

        ivReturn.setOnClickListener(this);
        ivSet.setOnClickListener(this);
        tvReport.setOnClickListener(this);
        tvZan.setOnClickListener(this);
        rlWriteEvaluate.setOnClickListener(this);
    }


    //点击事件的实现

    @Override
    public void onClick(View view) {

        switch (view.getId()){

            case R.id.iv_return:

                //返回
                finish();
                break;

            case R.id.iv_set:
                break;

            case R.id.rl_write_evaluate:

                intent = new Intent(this,PublishEvaluateActivity.class);
                startActivity(intent);
                break;

            case R.id.tv_report:

                LayoutInflater inflater = getLayoutInflater();

                View toastView = inflater.inflate(R.layout.layout_set_toast,null);
                TextView tvToast = (TextView) toastView.findViewById(R.id.tv_toast);
                tvToast.setText("举报成功");
                Toast toast = new Toast(this);
                toast.setGravity(Gravity.CENTER,0,25);
                toast.setDuration(Toast.LENGTH_SHORT);
                toast.setView(toastView);
                toast.show();
                break;

            case R.id.tv_zan:

                Toast.makeText(this,"点赞成功",Toast.LENGTH_SHORT).show();
                break;
        }
    }
}
